package com.weixin.dao.impl;

import java.sql.SQLException;
import java.util.List;

import org.apache.commons.dbutils.handlers.BeanHandler;
import org.apache.commons.dbutils.handlers.BeanListHandler;

import com.weixin.dao.IStorehouseDao;
import com.weixin.entity.Storehouse;
import com.weixin.util.C3p0Util;

public class StorehouseDaoImpl implements IStorehouseDao {
	C3p0Util c3p0=new C3p0Util();
	
	@Override
	public List<Storehouse> selectAll() throws SQLException {
		String sql="select * from storehouse_tb";
		return c3p0.getqr().query(sql, new BeanListHandler<Storehouse>(Storehouse.class));
	}

	@Override
	public Storehouse selectById(int storehouse_id) throws SQLException {
		String sql="select * from storehouse_tb where storehouse_id=?";
		return c3p0.getqr().query(sql, new BeanHandler<Storehouse>(Storehouse.class),storehouse_id);
	}

}
